package mil.af.amc.adpetracker.service;

import mil.af.amc.adpetracker.dao.EquipmentTypeDao;
import mil.af.amc.adpetracker.dao.ManufacturerDao;
import mil.af.amc.adpetracker.model.EquipmentType;
import mil.af.amc.adpetracker.model.Manufacturer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Please Fill in this Javadoc
 *
 * @author TSgt Jason Ferguson
 */
@Service("equipmentTypeService")
public class EquipmentTypeServiceImpl implements EquipmentTypeService {

    private EquipmentTypeDao equipmentTypeDao;

    @Autowired
    public void setEquipmentTypeDao(EquipmentTypeDao equipmentTypeDao) {
        this.equipmentTypeDao = equipmentTypeDao;
    }

    private ManufacturerDao manufacturerDao;

    @Autowired
    public void setManufacturerDao(ManufacturerDao manufacturerDao) {
        this.manufacturerDao = manufacturerDao;
    }

    public EquipmentType getById(int equipmentTypeId) {

        return equipmentTypeDao.getById(equipmentTypeId);
    }

    public List<EquipmentType> getAll() {

        return equipmentTypeDao.getAll();
    }

    public List<EquipmentType> getByManufacturer(int manufacturerId) {

        Manufacturer manu = manufacturerDao.getById(manufacturerId);
        return equipmentTypeDao.getByManufacturer(manu);
    }
}
